<template>
  <div>
    <el-form :inline="true" :model="searchItem" class="demo-form-inline" size="mini">
      <el-form-item class="cls-choose">
        <el-select v-model="searchItem.countType" placeholder="平台">
          <el-option
            v-for="item in platsList"
            :key="item.label"
            :label="item.label"
            :value="item.value"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item class="cls-choose">
        <el-select v-model="searchItem.shopName" placeholder="店名/昵称">
          <el-option
            v-for="item in storeList"
            :key="item.label"
            :label="item.label"
            :value="item.value"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item class="reason-cls">
        <el-input v-model="searchItem.reason" placeholder="请输入拍手账号/拉黑/解除原因"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onsearch">查询</el-button>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="addBlackList">添加</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  data() {
    return {
      platsList: [],
      storeList: [],
      searchItem: {
        shopName: '',
        countType: '',
        reason: ''
      }
    }
  },
  created() {
    this.getPlat()
    this.getstore()
  },
  methods: {
    async getPlat() {
      const { data } = await this._axios.get('/pttype/findallenable')
      data.forEach((item) => {
        this.platsList.push({
          value: item.ptTypeId,
          label: item.ptTypeName,
          url: item.ptLogoUrl
        })
      })
    },
    async getstore() {
      const { data } = await this._axios.get(
        `/store/findstorelistbysellerphone`
      )
      data.forEach((item) => {
        this.storeList.push({
          value: item.storeId,
          label: item.storeName
        })
      })
    },
    onsearch() {
      this.$emit('searchData', this.searchItem)
    },
    addBlackList() {}
  }
}
</script>

<style lang="scss" scoped>
.links-set {
  .el-col {
    line-height: 34px;

    &:first-of-type {
      text-align: right;
      margin-right: 20px;
      font-size: 14px;
      font-weight: 500;
    }
  }
}

.el-form {
  padding-top: 20px;
}

.cls-choose {
  width: 120px;

  &:first-of-type {
    width: 80px;
  }
}

.reason-cls {
  .el-input {
    width: 220px;
  }
}
</style>
